package com.atguigu.config;

import com.atguigu.bean.Color;
import com.atguigu.bean.Person;
import org.springframework.context.annotation.*;

/**
 * @Description :
 * @Version : V1.0.0
 * @Date : 2022/9/1 15:04
 */

/**
 * @Configuration注解告诉Spring这是一个配置类，类似Spring中的xml文件
 */
@Configuration
@ComponentScan("com.atguigu.bean")
@Import(MyBeanPostProcessor.class)
@ComponentScan(value = "com.atguigu")
@EnableAspectJAutoProxy
public class AnnotationConfig {

    @Bean("xiaomin")
    public Person person01() {
        return new Person("xiaomin", 20);
    }

    @Bean("bill")
    @Conditional(WindowsCondition.class)
    public Person person02() {
        return new Person("bill", 20);
    }

    @Bean("linux")
    @Conditional(LinuxCondition.class)
    public Person person03() {
        return new Person("linux", 20);
    }

    @Bean
    public Color color() {
        return new Color();
    }

}
